package com.allwees.support.marketing.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.allwees.support.marketing.dto.HotWordDto;
import lombok.Data;

import java.util.Date;

/**
 * @Author Daniel
 * @Version 1.0.0
 * @Description
 * @CreateTime 2020/8/31 16:24
 */
@Data
@TableName("prod_hot_word")
public class HotWord {
    @TableId(type = IdType.AUTO)
    private Long id;

    private String word;

    private Boolean highlight;

    private Integer sort;

    /**
     * 0-启用 1-禁用
     */
    private Integer status;

    @TableField(fill = FieldFill.INSERT)
    private Date createdAt;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedAt;

    @JsonIgnore
    public boolean isValid() {
        return this.status == 0;
    }

    public HotWord() {
    }

    public HotWord(HotWordDto dto) {
        this.id = dto.getId();
        this.word = dto.getWord();
        this.highlight = dto.getHighlight();
        this.sort = dto.getSort();
    }
}
